home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_A / AUXIO.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  73 lines

  1. /* $Id: auxio.h,v 1.1 1997/03/14 21:05:27 jj Exp $
  2.  * auxio.h:  Definitions and code for the Auxiliary I/O register.
  3.  *
  4.  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  5.  */
  6. #ifndef _SPARC64_AUXIO_H
  7. #define _SPARC64_AUXIO_H
  8.  
  9. #include <asm/system.h>
  10.  
  11. /* FIXME: All of this should be checked for sun4u. It has /sbus/auxio, but
  12.    I don't know whether it is the same and don't have a floppy */
  13.  
  14. extern unsigned char *auxio_register;
  15.  
  16. /* This register is an unsigned char in IO space.  It does two things.
  17.  * First, it is used to control the front panel LED light on machines
  18.  * that have it (good for testing entry points to trap handlers and irq's)
  19.  * Secondly, it controls various floppy drive parameters.
  20.  */
  21. #define AUXIO_ORMEIN      0xf0    /* All writes must set these bits. */
  22. #define AUXIO_ORMEIN4M    0xc0    /* sun4m - All writes must set these bits. */
  23. #define AUXIO_FLPY_DENS   0x20    /* Floppy density, high if set. Read only. */
  24. #define AUXIO_FLPY_DCHG   0x10    /* A disk change occurred.  Read only. */
  25. #define AUXIO_EDGE_ON     0x10    /* sun4m - On means Jumper block is in. */
  26. #define AUXIO_FLPY_DSEL   0x08    /* Drive select/start-motor. Write only. */
  27. #define AUXIO_LINK_TEST   0x08    /* sun4m - On means TPE Carrier detect. */
  28.  
  29. /* Set the following to one, then zero, after doing a pseudo DMA transfer. */
  30. #define AUXIO_FLPY_TCNT   0x04    /* Floppy terminal count. Write only. */
  31.  
  32. /* Set the following to zero to eject the floppy. */
  33. #define AUXIO_FLPY_EJCT   0x02    /* Eject floppy disk.  Write only. */
  34. #define AUXIO_LED         0x01    /* On if set, off if unset. Read/Write */
  35.  
  36. #define AUXREG   ((volatile unsigned char *)(auxio_register))
  37.  
  38. /* These are available on sun4c */
  39. #define TURN_ON_LED   if (AUXREG) *AUXREG = (*AUXREG | AUXIO_ORMEIN | AUXIO_LED)
  40. #define TURN_OFF_LED  if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_LED))
  41. #define FLIP_LED      if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) ^ AUXIO_LED)
  42. #define FLPY_MOTORON  if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) | AUXIO_FLPY_DSEL)
  43. #define FLPY_MOTOROFF if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_FLPY_DSEL))
  44. #define FLPY_TCNTON   if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) | AUXIO_FLPY_TCNT)
  45. #define FLPY_TCNTOFF  if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_FLPY_TCNT))
  46.  
  47. #ifndef __ASSEMBLY__
  48. extern __inline__ void set_auxio(unsigned char bits_on, unsigned char bits_off)
  49. {
  50.     unsigned char regval;
  51.     unsigned long flags;
  52.  
  53.     save_flags(flags); cli();
  54.  
  55.     if(AUXREG) {
  56.         regval = *AUXREG;
  57.         *AUXREG = ((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN4M;
  58.     }
  59.     restore_flags(flags);
  60. }
  61. #endif /* !(__ASSEMBLY__) */
  62.  
  63.  
  64. /* AUXIO2 (Power Off Control) */
  65. extern __volatile__ unsigned char * auxio_power_register;
  66.  
  67. #define    AUXIO_POWER_DETECT_FAILURE    32
  68. #define    AUXIO_POWER_CLEAR_FAILURE    2
  69. #define    AUXIO_POWER_OFF            1
  70.  
  71.  
  72. #endif /* !(_SPARC_AUXIO_H) */
  73.